
#ifndef _UTIL_MISC_H_
#define _UTIL_MISC_H_

#include "xtypes.h"
#include "util_image.h"
#include "xstring.h"



/*-----------------------------------------------------------------
Functions
-----------------------------------------------------------------*/
int_t GetSysProcessorNum();
void blit_from_canvas_to_dc( uint_t hDevice, CxSphereCanvas& canvas, int_t x_start=0, int_t y_start=0 );


int_t Bin2TextLen( int_t nBinLen );
int_t Text2BinLen( int_t nTextLen );
int_t Bin2Text( CxString & strTextOut, wildptr_t lpData, int_t nLength );
int_t Text2Bin( wildptr_t lpBuffer, int_t nBufLen, const CxString & strText );
int_t Text2Bin( wildptr_t lpBuffer, int_t nBufLen, lpcstr_t pszText, int_t nTextLen );






CxString xUrlStyleFilter_Chr2Byte( const CxString& _Str );


CxString Convert_MBCS_To_UNICODE( const CxString& _Str );
CxString Convert_UNICODE_To_MBCS( const CxString& _Str );
CxString Convert_UTF8_To_UNICODE( const CxString& _Str );
CxString Convert_UNICODE_To_UTF8( const CxString& _Str );
CxString Convert_UTF8_To_MBCS( const CxString& _Str, uint_t _LocalCodePage = 936 );
CxString Convert_MBCS_To_UTF8( const CxString& _Str, uint_t _LocalCodePage = 936 );












/*-----------------------------------------------------------------
Classes
-----------------------------------------------------------------*/
class xCrc32
{
	static unsigned long m_CrcTable[256];
	static unsigned long Reflect(unsigned long _ref, char ch);
	static bool _InitTable();

public:
	static unsigned long Start();
	static unsigned long Add( unsigned long nCode, void * lpData, int nDataLen );
	static unsigned long End( unsigned long nCode );
	static unsigned long Gen( void * lpData, int nDataLen );
};





#endif //_UTIL_MISC_H_

